/**
 * @author 史鑫鑫
 * @description 分组相关接口合集
 * @date 2021-03-06
 * @modefied 史鑫鑫
 */
import request from '@/utils/request'

/**
 * 创建分组
 * @param {String} organizationName 分组名
 */
export function organizationCreate (organizationName) {
  return request({
    url: `/c/api/v2/contact/organization/create/${organizationName}`,
    method: 'post'
  })
}

/**
 * 删除分组
 * @param {String} organizationId 分组id
 */
export function organizationDelete (organizationId) {
  return request({
    url: `/c/api/v2/contact/organization/${organizationId}`,
    method: 'delete'
  })
}

/**
 * 修改组名
 * @param {String} organizationId 分组id
 * @param {String} organizationName 分组名
 */
export function modifyOrganizationInfo (organizationId, organizationName) {
  return request({
    url: '/c/api/v2/contact/organization/organizationName',
    method: 'put',
    data: {
      organizationId,
      organizationName
    }
  })
}

/**
 * 获取全部好友
 */
export function organizationAllFriends () {
  return request({
    url: '/c/api/v2/contact/organization/friends',
    method: 'get'
  })
}

/**
 * 获取本人所有分组信息
 */
export function organizationInfo () {
  return request({
    url: '/c/api/v2/contact/organization/info',
    method: 'get'
  })
}

/**
 * 将好友移动到某个分组
 * @param {String} friendId 好友id
 * @param {String} organizationId 分组id
 */
export function organizationMove (friendId, organizationId) {
  return request({
    url: '/c/api/v2/contact/organization/move',
    method: 'put',
    data: {
      friendId,
      organizationId
    }
  })
}
